/*
 * Tonysoft.com Inc.
 *
 * Copyright (c) 2004-2007 All Rights Reserved.
 */
package org.dreamfly.core.remote.generator;

import org.dreamfly.core.remote.register.ServiceProxyGenerator;
import org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean;

import java.util.Properties;

/**
 * @see
 * 
 * @author Tony
 */
public class HttpInvokeServiceProxyGenerator implements ServiceProxyGenerator {

    /** HttpInvoker������?�� */
    private HttpInvokerProxyFactoryBean httpInvokerFactory = new HttpInvokerProxyFactoryBean();

    /*
     * @see com.alipay.xfiredemo.common.ServiceProxyGenerator#getService(java.lang.Class, java.lang.String,
     *      java.util.Properties)
     */
    public Object getService(Class serviceClass, String serviceUrl, Properties props) {

        // Todo initial httpInvokerFactory with props

        httpInvokerFactory.setServiceInterface(serviceClass);
        httpInvokerFactory.setServiceUrl(serviceUrl);

        // must invoke this method
        httpInvokerFactory.afterPropertiesSet();

        return httpInvokerFactory.getObject();
    }

}
